﻿#include <iostream>
#include <string>
#include <vector>

using namespace std;

// 图书馆
struct Library
{
public:
	// 借阅书名
	string Title_name;
	// 借阅书籍编号
	int Book_number;
	// 借阅书籍作者
	string Book_writer;
	// 借阅人
	string Borrower;
	// 借阅人卡号
	int Borrower_number;
	Library()
	{
	}
	Library(string Title_name, int Book_number, string Book_writer, string Borrower, int Borrower_number)
		: Title_name(Title_name), Book_number(Book_number), Book_writer(Book_writer), Borrower(Borrower), Borrower_number(Borrower_number)
	{
	}
};
int main()
{
	vector<Library> A1;

	A1.push_back(Library("傲慢与偏见", 1, "简.奥斯丁", "张三", 1));
	A1.push_back(Library("呼啸山庄", 2, "艾米莉.勃朗特", "李四", 2));
	A1.push_back(Library("一九八四", 3, "乔治.奥威尔", "王五", 3));
	A1.push_back(Library("米德尔马契", 4, "乔治.艾略特", "老八", 4));


	
	vector<Library>::iterator HTXY = A1.begin();
	advance(HTXY, 2);

	A1.insert(HTXY, Library("金色笔记", 10, "多丽丝.莱辛", "张某", 5));

	// 第二次插入初始化一下迭代器
	HTXY = A1.begin();
	advance(HTXY, 2);
	A1.insert(HTXY, Library("马龙之死", 7, "塞缪尔.贝克特", "李某", 6));
	
	for (vector<Library>::iterator HTXY = A1.begin(); HTXY != A1.end(); HTXY++)
	{
		Library temp = *HTXY;
		cout << "借阅书名: " << (*HTXY).Title_name << " 借阅书籍编号: " << (*HTXY).Book_number << " 借阅书籍作者: " << (*HTXY).Book_writer << " 借阅人: " << (*HTXY).Borrower << " 借阅人卡号: " << (*HTXY).Borrower_number << endl;
	}

}
